import 'package:flutter/material.dart';
import 'moments_page.dart';

class DiscoverPage extends StatelessWidget {
  const DiscoverPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('发现'),
      ),
      body: ListView(
        children: [
          _buildItem(
            context,
            icon: Icons.camera,
            label: '朋友圈',
            color: Colors.blueAccent,
            onTap: () {
              Navigator.push(
                context,
                MaterialPageRoute(builder: (context) => const MomentsPage()),
              );
            },
          ),
          const SizedBox(height: 8),
          _buildItem(context, icon: Icons.qr_code_scanner, label: '扫一扫', color: Colors.blue),
          const Divider(height: 1),
          _buildItem(context, icon: Icons.vibration, label: '摇一摇', color: Colors.blue),
          const SizedBox(height: 8),
          _buildItem(context, icon: Icons.remove_red_eye, label: '看一看', color: Colors.orange),
          const Divider(height: 1),
          _buildItem(context, icon: Icons.search, label: '搜一搜', color: Colors.red),
        ],
      ),
    );
  }

  Widget _buildItem(
    BuildContext context, {
    required IconData icon,
    required String label,
    required Color color,
    VoidCallback? onTap,
  }) {
    return ListTile(
      leading: Icon(icon, color: color),
      title: Text(label),
      trailing: const Icon(Icons.chevron_right, color: Colors.grey),
      tileColor: Colors.white,
      onTap: onTap,
    );
  }
}
